package com.qf.dao;/*
 *保护你的大熊
 *2021/11/22
 *22:05
 */

import com.qf.pojo.SysUsers;
import org.apache.ibatis.annotations.Select;

import java.util.Set;

public interface SysUsersMapper {

    @Select("select * from sys_users where username = #{username}")
    SysUsers findByUsername(String username);

    @Select("select r.name " +
            "from sys_user_role ur,sys_role r " +
            "where ur.r_id = r.id and ur.u_id = #{userId}")
    Set<String> findRolesByUserId(int id);

    @Select("select m.perms " +
            "from sys_user_role ur,sys_role_menu rm,sys_menu m " +
            "where ur.r_id = rm.r_id and rm.m_id = m.id and ur.u_id = #{userId}")
    Set<String> findPermsByUserId(int id);
}
